package com.mazaiting.classfile.constant.info;

import com.mazaiting.classfile.ClassReader;
import com.mazaiting.classfile.constant.ConstantPool;
import com.mazaiting.util.ByteUtil;
import lombok.Getter;

/**
 * 整型常量信息
 * 比int更小的boolean、byte、short和char类型的常量也放在 CONSTANT_Integer_info
 * @author mazaiting
 * @since 2021/8/11
 */
@Getter
public class ConstantIntegerInfo extends ConstantInfo {
    /**
     * 数值
     */
    private int value;

    public ConstantIntegerInfo(ConstantPool pool) {
        super(pool);
    }

    @Override
    public void readInfo(ClassReader reader) {
        this.value = reader.readU4ToInt();
    }

    @Override
    public String toString() {
        return "ConstantIntegerInfo{" +
                "value=" + value +
                '}';
    }
}


















